import React from 'react';
import { Link } from 'react-router-dom';
import api from '../../api/api.js';

class Home extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            mytext: ''
        }
    }
    getData(){
        api.getData().then( res => {
            this.setState({
                mytext: res
            })
        })
    }
    componentWillMount(){
        this.getData();
    }
    render(){
        return (
            <div>
                <div>{this.state.mytext}</div>
                <div>
                    <Link to="/about">
                        <div>关于我们</div>
                    </Link>
                </div>
            </div>
        )
    }
}

export default Home;